<?php

namespace App\Repositories;

use App\Models\Area;
use App\Interfaces\AreaService;
use Cache;
class AreaRepository implements AreaService{

    protected  $cache = true;

    public function getArea(){


        return Area::getArea();

    }

    public function getAreaCache(){

        //缓存
        $cache = Cache::get('area');
        if ($cache){
            return $cache;
        }else{
            $tree = Area::getTree();
            Cache::forever('area', $tree);
            return $tree;
        }
    }


}